
if exists(select name from sysobjects where name = 'sp_KhuyenMaiCreate')
	drop proc sp_KhuyenMaiCreate
go
/*
	Created by: Phuoc NH
	Created on: 13/05/2013 (dd/mm/yyyy)
	Description: 
	--

	File:$sql-scripts/Proc.sp_KhuyenMaiCreate.sql
*/


-- =============================================
-- Author		: HP
-- Create date	: 2014-04-03
-- =============================================

CREATE PROCEDURE sp_KhuyenMaiCreate
			
	@KhuyenMaiId		INT,
	@TieuDe     		NVARCHAR(500),
	@GiaNiemYet 		int,
	@GiaKM      		int,
	@ThoiGian   		VARCHAR(32)=null,
	@Link       		VARCHAR(500)='',
	@ImageSmall 		VARCHAR(128)='',
	@SiteNguon  		VARCHAR(100)='',
	@Provider   		VARCHAR(100)='',
	@Summary    		NVARCHAR(1000)='',
	@ThuTu      		INT,
	@TrangThai  		TINYINT,
	@NguoiTao   		INT,
	@NguoiSua   		INT,
	@LoaiKhuyenMaiId int,
	@WebId int,
	@ThanhPho int
	
AS
BEGIN
    
        	INSERT INTO KhuyenMai
        	(
		[TieuDe],
		[GiaNiemYet],
		[GiaKM],
		[ThoiGian],
		[Link],
		[ImageSmall],
		[SiteNguon],
		[Provider],
		[Summary],
		[ThuTu],
		[TrangThai],
		[NguoiTao],
		[NguoiSua],
		webid,
		ThanhPho
        	) 
        	VALUES 
        	(
		@TieuDe,
		@GiaNiemYet,
		@GiaKM,
		@ThoiGian,
		@Link,
		@ImageSmall,
		@SiteNguon,
		@Provider,
		@Summary,
		@ThuTu,
		@TrangThai,
		@NguoiTao,
		@NguoiSua,
		@WebId,
		@ThanhPho
        	)
      --
      insert LoaiKhuyenMaiAndKhuyenMai(KhuyenMaiId, LoaiKhuyenMaiId) values(@@IDENTITY, @LoaiKhuyenMaiId)
    
END
GO


